# _*_ coding: UTF-8 _*_
# @Time     : 2022/4/22 9:53
# @Author   : Li Jie
# @Site     : http://www.cdtest.cn/
# @File     : 下拉菜单操作.py
# @Software : PyCharm

from selenium import webdriver
import time
from selenium.webdriver.common.by import By


def foo1():
    """

    :return:
    """
    driver = webdriver.Chrome()

    driver.maximize_window()

    driver.get(r"https://music.163.com/#/discover/toplist?id=3778678")

    # 切换到内嵌页面iframe
    # driver.switch_to.frame(参数)
    # 参数有三种：iframe的name或id属性值，找到这个iframe元素作为参数，index索引值
    driver.switch_to.frame("g_iframe")

    driver.find_element(By.XPATH, '//span[@data-res-id="1901371647"]').click()  # 点击播放图标

    time.sleep(100)

    driver.quit()


if __name__ == "__main__":
    foo1()
